import request from "@/utils/request";

// 创建自定义表单
export function createCustomForm(data) {
  return request({
    url: "/user-form/v1/create",
    method: "post",
    data: data,
  });
}

// 获取自定义表单
export function getCustomForm(params) {
  return request({
    url: "/user-form/v1/list",
    method: "get",
    params: params,
  });
}

// 更新自定义表单
export function updateCustomForm(data) {
  return request({
    url: "/user-form/v1/update",
    method: "put",
    data: data,
  });
}

// 删除自定义表单
export function deleteCustomForm(id) {
  return request({
    url: "/user-form/v1/delete/" + id,
    method: "delete",
  });
}

// 停止自定义表单
export function stopCustomForm(id) {
  return request({
    url: "/user-form/v1/stop/" + id,
    method: "delete",
  });
}

// 发布自定义表单
export function publishCustomForm(id) {
  return request({
    url: "/user-form/v1/publish/" + id,
    method: "delete",
  });
}

// 根据key获取自定义表单
export function getCustomFormByKey(key) {
  return request({
    url: "/user-form/v1/query/" + key,
    method: "get",
  });
}

// 创建自定义表单分类
export function createCustomFormCategory(data) {
  return request({
    url: "/user-form-category/v1/create",
    method: "post",
    data: data,
  });
}

// 获取自定义表单分类
export function getCustomFormCategory(params) {
  return request({
    url: "/user-form-category/v1/list",
    method: "get",
    params: params,
  });
}

// 更新自定义表单分类
export function updateCustomFormCategory(id, data) {
  return request({
    url: "/user-form-category/v1/update",
    method: "put",
    data: data,
  });
}

// 删除自定义表单分类
export function deleteCustomFormCategory(id) {
  return request({
    url: "/user-form-category/v1/delete/" + id,
    method: "delete",
  });
}

// 根据key获取自定义表单分类
export function getCustomFormCategoryById(id) {
  return request({
    url: "/user-form-category/v1/getById/" + id,
    method: "get",
  });
}

// 创建自定义表单数据
export function createCustomFormData(data) {
  return request({
    url: "/user-form-data/v1/add",
    method: "post",
    data: data,
  });
}

// 获取自定义表单数据
export function getCustomFormData(params) {
  return request({
    url: "/user-form-data/v1/list",
    method: "get",
    params: params,
  });
}

// 更新自定义表单数据
export function updateCustomFormData(data) {
  return request({
    url: "/user-form-data/v1/update",
    method: "put",
    data: data,
  });
}

// 删除自定义表单数据
export function deleteCustomFormData(id) {
  return request({
    url: "/user-form-data/v1/delete/" + id,
    method: "delete",
  });
}

// 设置自定义表单数据状态
export function setCustomFormDataStatus(data) {
  return request({
    url: "/user-form-data/v1/updateStatus",
    method: "post",
    data: data,
  });
}
